package com.controller.backend;

import com.biz.SysDictionaryBiz;
import com.core.Result;
import com.core.ResultGenerator;
import com.entity.model.SysDictionary;
import com.github.pagehelper.PageInfo;
import com.util.webpage.PageData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* Created by jc on 2019/11/16.
*/
@Controller
@RequestMapping("/backend/security/sysDictionary")
public class SysDictionaryController extends BaseController<SysDictionary>{
    @Autowired
    private SysDictionaryBiz sysDictionaryBiz;

    @RequestMapping(value = "index")
    public String index() throws Exception {
        return "/backend/security/tag/list";
    }

    @RequestMapping(value = "detail")
    public String detail() throws Exception {
        return "/backend/security/tag/form";
    }


    //获取门店信息以及上下架状态
    @RequestMapping(value = "findList")
    @ResponseBody
    public Result findList(HttpServletRequest request) {
        PageData cond = new PageData(request);
        List<SysDictionary> list = sysDictionaryBiz.findList(cond);
        PageInfo<SysDictionary> pageInfo = new PageInfo<SysDictionary>(list);
        Integer total = (int) pageInfo.getTotal();
        return ResultGenerator.genSuccessResult(list, total);
    }
}
